<?php
/**
 * Created by PhpStorm.
 * User: Dave
 * Date: 2018/6/28
 * Time: 15:49
 */

ini_set('display_errors', 1);
error_reporting(-1);
require_once '/data/wwwroot/g_vendor/autoload.php';

use Biz\model\smallenergy\SmallEnergyMessage as mSmallEnergyMessage;
use Biz\model\smallenergy\SmallEnergyShop as mSmallEnergyShop;

$data = mSmallEnergyMessage::FixMessage();
foreach($data as $value){
    $fromId = $value['small_from_to_uid'];
    $fromId = explode('_', $fromId);
    $groupid1 = array_shift($fromId);
    $groupid2 = array_shift($fromId);
    $settingId = $groupid1 . '_' .$groupid2 . '_9999';
    if(strlen($settingId) > 12 ){
        $shopId = mSmallEnergyShop::getShopByGroupId($settingId, 'shop_id');
        $result = mSmallEnergyMessage::FixUpdate($value['small_from_to_uid'], $settingId, $shopId);
        if($result) {
            var_dump("商家 $shopId 修复成功");
        }
    }
}
